package com.yxw.springmvc.userBehavior.service.impl;

import com.yxw.springmvc.userBehavior.convert.BasicPrivConvert;
import com.yxw.springmvc.userBehavior.mapper.BasicPrivMapper;
import com.yxw.springmvc.userBehavior.model.BasicPriv;
import com.yxw.springmvc.userBehavior.request.BasicPrivAddRequest;
import com.yxw.springmvc.userBehavior.service.BasicPrivManageService;
import com.yxw.springmvc.userBehavior.util.CollectionUtils;

import javax.annotation.Resource;

/**
 * Created by hp on 2016/9/29.
 */
public class BasicPrivManageServiceImpl implements BasicPrivManageService{

    @Resource
    private BasicPrivConvert basicPrivConvert;

    @Resource
    private BasicPrivMapper basicPrivMapper;

    @Override
    public BasicPriv add(BasicPrivAddRequest request) {
        if(CollectionUtils.isEmpty(request)){
            return null;
        }
        BasicPriv priv = basicPrivConvert.convert(request);
        basicPrivMapper.insert(priv);
        return priv;
    }
}
